package com.pengtu.dao.app;

import java.io.Serializable;

import org.springframework.stereotype.Repository;

import com.pengtu.dao.hibernate.HibernateDao;
import com.pengtu.entity.app.MessageInfo;

@Repository
public class MessageInfoDao extends HibernateDao<MessageInfo, Serializable> {

	public void updateMessageInfo(String id, String del) {
		String hql = "update MessageInfo set " + del + "= '1'" + " where id = '"
				+ id + "'";
	    this.batchExecute(hql);
	}

	public long getNoReadCount(String msgType,String userId) {
		String hql = "from MessageInfo where  receivedel = 0" 
		+ " and receiveUser = '" + userId + "' and readFlag = 0 ";
		if(msgType != null && !msgType.equals("")){
			hql +=" and type = " + msgType ;
		}
		return this.countHqlResult(hql);
	}

}
